﻿#include "captchainputdialog.h"
#include "ui_captchainputdialog.h"
#include <QDialogButtonBox>
#include <QAbstractButton>
#include <QPicture>

CaptchaInputDialog::CaptchaInputDialog(const QImage &image, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CaptchaInputDialog)
{
    ui->setupUi(this);
    setImage(image);
}

CaptchaInputDialog::~CaptchaInputDialog()
{
    delete ui;
}

QString CaptchaInputDialog::inputText()
{
    return ui->captchaInput->text();
}

void CaptchaInputDialog::setImage(const QImage &image)
{
    ui->imageLabel->setPixmap(QPixmap::fromImage(image));
}

void CaptchaInputDialog::on_buttonBox_clicked(QAbstractButton *button)
{
    if (ui->buttonBox->standardButton(button) == QDialogButtonBox::StandardButton::Reset)
    {
        emit resetClicked();
    }
}
